"""
RagFlow 客户端 GUI 批量解析功能模块
"""

from PySide6.QtWidgets import QMainWindow, QWidget, QVBoxLayout, QTabWidget

from ragflow_client.gui.features.base_feature import BaseFeature
from ragflow_client.gui.components.batch_parse_tab import BatchParseTabWidget


class BatchParseFeature(BaseFeature):
    """批量解析功能类"""
    
    def __init__(self, parent=None):
        """初始化批量解析功能"""
        super().__init__(parent)
    
    def execute(self):
        """执行批量解析功能"""
        # 创建批量解析选项卡
        batch_parse_tab = BatchParseTabWidget(self.parent)
        
        # 创建一个新窗口来显示批量解析选项卡
        window = QMainWindow(self.parent)
        window.setWindowTitle("批量解析")
        window.setMinimumSize(800, 600)
        
        # 创建中央部件
        central_widget = QWidget()
        window.setCentralWidget(central_widget)
        
        # 创建布局
        layout = QVBoxLayout(central_widget)
        
        # 创建选项卡部件
        tab_widget = QTabWidget()
        tab_widget.addTab(batch_parse_tab, "批量解析")
        
        # 添加选项卡部件到布局
        layout.addWidget(tab_widget)
        
        # 显示窗口
        window.show()